local userId = ARGV[1]
local exhibitionId = ARGV[2]
-- 使用标准命名规则
local likedUsersKey = "exhibition:" .. exhibitionId .. ":liked_users"
local likeCountKey = "exhibition:" .. exhibitionId .. ":like_count"

-- 检查是否已点赞
if redis.call("SISMEMBER", likedUsersKey, userId) == 1 then
    return 1 -- 已点赞
end

-- 执行点赞操作
redis.call("SADD", likedUsersKey, userId)
redis.call("INCR", likeCountKey)  -- 更简洁的写法

return 0 -- 点赞成功
